<html>
<head>
<title>Prime Numbers</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
<script>
function prime(max) {
	var p = [2, 3, 5];
	var c = 5;
	var f = function(n) {
		if (max < n) return true;
		var s = Math.sqrt(n);
		var l = p.length;
	    for (var i = 0; i < l; i++) {
		    var c = p[i];
		    if (n % c == 0) break;
		    if (s < c) {
			    p.push(n);
			    break;
		    }
		}
		return false;
	};
	while (true) {
		if (f(c += 2) || f(c += 4)) break;
	}
	return p;
}
</script> 
</head> 
<body style="font-family:monospace;font-size:12px;">
Prime Numbers<br/>
<script>
var max = 1000000;
var p = prime(max);
document.writeln(p.length + "/" + max + "<br/>");
for (var i = 0; i < p.length; i++) {
	document.writeln(p[i]);
}
</script> 
</body> 
</html> 